@include('public.page_styles')
<link rel="stylesheet" href="{{ asset("/AdminLTE/bower_components/bootstrap-daterangepicker/daterangepicker.css") }}">
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
@include('public.top')
<!-- Left side column. contains the logo and sidebar -->
@include('public.sidebar')
<!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                {{ trans('message.serveProject') }}
                <small>{{ trans('message.edit') }}</small>
            </h1>
            <ol class="breadcrumb">
                <li><a ><i class="fa fa-dashboard"></i> {{ trans('message.home') }}</a></li>
                <li><a href="{{ url('serveProject/list') }}"> {{ trans('message.serveProject') }} {{ trans('message.list') }}</a></li>
                <li class="active">{{ trans('message.serveProject') }}{{ trans('message.edit') }}</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-md-12">
                    <!-- Horizontal Form -->
                    <div class="box box-info">
                        <div class="box-header with-border">
                            <h3 class="box-title"> {{ trans('message.edit') }}</h3>
                            <div class="box-tools">
                                <div class="btn-group pull-right" style="margin-right: 10px">
                                    <a href="{{ url('serveProject/list') }}" class="btn btn-sm btn-default"><i class="fa fa-list"></i>&nbsp; {{ trans('message.list') }}</a>
                                </div>
                                <div class="btn-group pull-right" style="margin-right: 10px">
                                    <a class="btn btn-sm btn-default form-history-back" onclick="goBack()" ><i class="fa fa-arrow-left"></i>&nbsp;{{ trans('message.history-back') }}</a>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-header -->
                        <!-- form start -->
                        <form name="editForm"  action="{{ url('serveProject/'.$serveProjectInfo->id) }}" method="post"  class="form-horizontal" >
                            <input type="hidden" name="_token"   value="{{ csrf_token() }}"/>
                            <input type="hidden" name="id"   value="{{ $serveProjectInfo->id }}"/>

                            <div class="box-body">
                                <div class="form-group">
                                    <label for="inputEmail3" class="col-sm-2 control-label">服务类型</label>
                                    <div class="col-sm-8">
                                        <span class="form-control-require">*</span>
                                        <select class="form-control" name="serveType" required>
                                            <option value="" >请选择</option>
                                            @if($serveType)
                                                @foreach($serveType as $value)
                                                    <option value="{{ $value->state }}" @if($serveProjectInfo->serveType == $value->state) selected @endif>{{ $value->stateName }}</option>
                                                @endforeach
                                            @endif
                                        </select>
                                    </div>
                                </div>

                                <div class="form-group {!! !$errors->has('serveName') ?: 'has-error' !!}">
                                    <label for="serveName" class="col-sm-2 control-label">服务名称</label>
                                    <div class="col-sm-8">
                                        <span class="form-control-require">*</span>
                                        <input type="hidden" name="serveNameHide"  value="{{ $serveProjectInfo->serveName }}" />
                                        <input type="text" class="form-control" id="serveName" name="serveName" placeholder="服务名称" value="{{ $serveProjectInfo->serveName }}"   required autofocus>
                                        @if($errors->has('serveName'))
                                            @foreach($errors->get('serveName') as $message)
                                                <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i>{{$message}}</label></br>
                                            @endforeach
                                        @endif
                                    </div>
                                </div>

                                <div class="form-group {!! !$errors->has('serveMoney') ?: 'has-error' !!}" >
                                    <label for="serveMoney" class="col-sm-2 control-label">服务金额</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" id="serveMoney" name="serveMoney" placeholder="金额" value="{{ $serveProjectInfo->serveMoney }}"   autofocus  onkeyup= "if( ! /\d+(\.\d{1,2})?/.test(this.value)){alert('只能输入数字，小数点后只能保留两位');this.value='';}">
                                        @if($errors->has('serveMoney'))
                                            @foreach($errors->get('serveMoney') as $message)
                                                <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i>{{$message}}</label></br>
                                            @endforeach
                                        @endif
                                    </div>
                                </div>

                                <div class="form-group ">
                                    <label for="serveDesc" class="col-sm-2 control-label">服务描述</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" id="serveDesc" name="serveDesc" placeholder="描述" value="{{ $serveProjectInfo->serveDesc }}"  >
                                    </div>
                                </div>

                                <div class="form-group ">
                                    <label for="month" class="col-sm-2 control-label">使用有效期</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" id="month" name="month" placeholder="输入月份" value="{{ $serveProjectInfo->validity }}" onkeyup= "if(! /^[0-9]{1,2}$/.test(this.value)){alert('只能输入数字');this.value='';}"  >
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label for="remark" class="col-sm-2 control-label">备注</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control" id="remark" name="remark" placeholder="" value="{{ $serveProjectInfo->remark }}"  >
                                    </div>
                                </div>

                            </div>
                            <!-- /.box-body -->
                            <div class="box-footer">
                                <div class="col-sm-2">
                                </div>
                                <div class="col-sm-8">
                                    <div class="btn-group pull-right">
                                        <button type="button" class="btn btn-info pull-right btn-js-form-submit" >提交</button>
                                    </div>
                                    <div class="btn-group pull-left">
                                        <button type="reset" class="btn btn-warning">撤销</button>
                                    </div>
                                </div>
                            </div>
                            <!-- /.box-footer -->
                        </form>
                    </div>
                    <!-- /.box -->
                </div>
                <!--/.col (right) -->
            </div>
            <!-- /.row -->
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
@include('public.bottom')

<!-- Control Sidebar -->
{{--@include('public.aside')--}}
<!-- /.control-sidebar -->
    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

@include('public.javascript')
{{--<script src="{{ asset ("/AdminLTE/bower_components/fastclick/lib/fastclick.js") }}" type="text/javascript"></script>--}}
<script src="{{ asset ("/AdminLTE/bower_components/moment/min/moment.min.js") }}" type="text/javascript"></script>
<script src="{{ asset ("/AdminLTE/bower_components/bootstrap-daterangepicker/daterangepicker.js") }}" type="text/javascript"></script>

<script type="text/javascript">

    jQuery(function ($) {
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': '{{ csrf_token() }}'
            }
        });


        @if(session()->has('fail'))
          alertMess("{{session()->get('fail')}}");
        @endif



    });

    var _ajaxSubmitSending = false;
    $(".btn-js-form-submit").click(function (e) {
        if (_ajaxSubmitSending) {
            return;
        } else {
            _ajaxSubmitSending = true;
            _loadingFuc();
        }

        $('form[name="editForm"]').submit();
        _ajaxSubmitSending = false;
        setTimeout(function(){
            $.unblockUI();
        }, 1500);
    });


</script>

</body>
</html>
